fix: prevent React error #31 when rendering workflow output objects#2972
Open
wingding12 wants to merge 3 commits intosimstudioai:mainfrom
Open
fix: prevent React error #31 when rendering workflow output objects#2972wingding12 wants to merge 3 commits intosimstudioai:mainfrom
wingding12 wants to merge 3 commits intosimstudioai:mainfrom
Conversation
|
@wingding12 is attempting to deploy a commit to the Sim Team on Vercel. A member of the Team first needs to authorize it. |
Contributor
Greptile SummaryThis PR introduces a defensive utility function Changes:
Observations:
Confidence Score: 4/5
Important Files Changed
Sequence DiagramsequenceDiagram
participant WF as Workflow/Node Output
participant Store as Store (notifications/copilot)
participant Component as UI Component
participant Util as safelyRenderValue()
participant React as React Renderer
Note over WF,React: Before PR (causes crash)
WF->>Store: output = {text: "hello", type: "text"}
Store->>Component: notification.message = object
Component->>React: render object directly
React-->>Component: ❌ Error #31: Objects are not valid as React child
Note over WF,React: After PR (safe rendering)
WF->>Store: output = {text: "hello", type: "text"}
Store->>Component: notification.message = object
Component->>Util: safelyRenderValue(object)
Util->>Util: JSON.stringify(object)
Util-->>Component: '{"text":"hello","type":"text"}'
Component->>React: render string
React-->>Component: ✅ Renders successfully
|
36009f9 to
af78728
Compare
…t objects Add safelyRenderValue utility function to handle objects, arrays, and other non-primitive types that could be rendered directly in React components. Applied to: - queued-messages.tsx: msg.content - notifications.tsx: notification.message - todo-list.tsx: todo.content Fixes simstudioai#2725
20cbe02 to
083fc72
Compare
Author
|
sorry for the messy commits, i had a gpg and email mismatch i've been racking my head to fix. hope they can be squashed cleanly! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
add safelyRenderValue utility function to handle objects, arrays, and other non-primitive types that could be rendered directly in React components
applied to:
Fixes #2725
Type of Change
Testing
no need for testing, just needed to correctly handle all value types
Checklist